#include"processbar.h"
#include<unistd.h>
typedef void (*callback_t)(int);//函数指针类型

void download(callback_t cb)
{
    int cur=0;
    int total=1000;
    while(cur<=total)
    {
        usleep(10000);
        cb(cur*100/total);
        cur+=10;
    }
    printf("\n");
}

int main()
{
    printf("domwloat: 1\n");
    download(processbar);
    inibar();
    printf("dowmload: 2\n");
    download(processbar);
    inibar();
    printf("domwloat: 3\n");
    download(processbar);
    inibar();
    printf("domwloat: 4\n");
    download(processbar);
    inibar();
    printf("\n");
    return 0;
}
